<html>
<head><meta charset="utf-8"><title>Soundness concerns around catch_unwind · project-ffi-unwind · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/index.html">project-ffi-unwind</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Soundness.20concerns.20around.20catch_unwind.html">Soundness concerns around catch_unwind</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="189294544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Soundness%20concerns%20around%20catch_unwind/near/189294544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Soundness.20concerns.20around.20catch_unwind.html#189294544">(Feb 28 2020 at 09:22)</a>:</h4>
<p>Discussion <a href="#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/updating.20uninitialized.20swapping" title="#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/updating.20uninitialized.20swapping">in the UCG</a> raised an interesting unwind-related concern: right now, it is legitimate (or at least, not unreasonable) for code to assume that every (Rust) function either returns or panics. Which means with <code>catch_unwind</code>, it'll definitely panic.<br>
crates like <code>take_mut</code> crucially rely on this and become unsound once there is a way for Rust code to unwind that is not caught by <code>catch_unwind</code>. I believe even <code>rayon</code> scoped threads would become unsound.</p>



<a name="189294568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Soundness%20concerns%20around%20catch_unwind/near/189294568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Soundness.20concerns.20around.20catch_unwind.html#189294568">(Feb 28 2020 at 09:23)</a>:</h4>
<p>oh nvm I see <span class="user-mention" data-user-id="143274">@Amanieu</span> already <a href="#narrow/stream/210922-project-ffi-unwind/topic/Catching.20and.20resuming.20foreign.20exceptions" title="#narrow/stream/210922-project-ffi-unwind/topic/Catching.20and.20resuming.20foreign.20exceptions">raised that here</a> <em>oops</em></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>